/*
 * @Author: 高瑞寒 15932717091@163.com
 * @Date: 2022-05-17 22:48:58
 * @LastEditTime: 2022-05-20 21:03:48
 * @LastEditors: 高瑞寒 15932717091@163.com
 * @Description:
 */
import store from '@/store'
import { createI18n } from 'vue-i18n'
import en from './lang/en'
import zh from './lang/zh'
const messages = {
  zh: {
    ...zh
  },
  en: {
    ...en
  }
}

const getStoreLanguage = () => {
  return store.getters.language
}
const i18n = createI18n({
  legacy: false,
  // 全局注入 $t 函数
  globalInjection: true,
  locale: getStoreLanguage(),
  messages
})

export default i18n
